package Demo;

public class Demo1 {
    public static void main(String[] args) {
        //启动方法
        use(new InterB() {
            @Override
            public void function() {
                System.out.println("匿名内部类实现的function方法");
            }
        });
        //启动方法
        InterB ib = get();
        ib.function();

        }
        public static void use(InterB ib){
        ib.function();
        }
        public static InterB get(){
        return new InterB() {
            @Override
            public void function() {
                System.out.println("返回的匿名内部类对象");

            }
        };
        }
    }


